home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / CDICTION / CSMARTED.H < prev    next >
Text File  |  1990-01-12  |  3KB  |  91 lines

  1. /*****************************************************************************
  2.     CSmartEditText: subclass of CEditText that adds some additional features.
  3.         These are:
  4.         
  5.     Ñ    In conjunction with CSmartDocument, supports tabbing through
  6.         edit text items as in dialogs and forms.
  7.         
  8.     Ñ    Keeps track of "dirty" state. Any changes to the text set the dirty
  9.         flag. This can be read by calling IsDirty() or cleared by calling
  10.         ClearDirty().
  11.         
  12.     Ñ    Can be toggled as edit or static text by calling SetEditable.
  13.     
  14.     Ñ    Support for default buttons or other items via the passReturns
  15.         flag. If this is set then CR and Enter keydowns are passed
  16.         up the chain of command. If the owning document is a CSmartDocument,
  17.         then these keydowns can be passed to some default object like a button.
  18.         
  19.     Ñ    Some other miscellaneous utilities.
  20.     
  21.     Ñ    Supports undo via SmartTETask.
  22.     
  23.     by Dan Podwall - you may do anything you please with this code except
  24.     charge for it, with the exception of normal network download charges.
  25.  
  26. *****************************************************************************/
  27.  
  28. #define _H_CSmartEditText
  29.  
  30. #include "CEditText.h"
  31. #include "defs.h"
  32.  
  33. typedef enum tTE_Command
  34. {
  35.     teCut,
  36.     teCopy,
  37.     tePaste,
  38.     teClear,
  39.     teType
  40.     
  41. } tTE_Command;
  42.  
  43.  
  44. struct CSmartEditText : CEditText
  45. {
  46.     /* instance variables */
  47.     
  48.     struct CSmartDocument    *itsSmartDoc;
  49.     Boolean                 isKeyTarget;
  50.     Boolean                 dirty;
  51.     Boolean                 editable;
  52.     Boolean                 passReturns;
  53.     struct CSmartTETask        *itsCurrentTask;
  54.     Int16                    firstTaskIndex;
  55.     Point                    lastSelect;
  56.     
  57.     /* public methods */
  58.  
  59.     virtual void ISmartEditText(CView *anEnclosure, CBureaucrat *aSupervisor,
  60.                         Int16 aWidth, Int16 aHeight,
  61.                         Int16 aHEncl, Int16 aVEncl,
  62.                         SizingOption aHSizing, SizingOption aVSizing,
  63.                         Int16 aLineWidth, Int16 firstTaskIndex);
  64.                     
  65.     virtual void DoCommand(Int32 theCommand);
  66.     
  67.     virtual void DoClick(Point hitPt, Int16 modifierKeys, Int32 when);
  68.     virtual void DoKeyDown(char theChar, Byte keyCode, EventRecord *macEvent);
  69.     virtual void SetTarget( Int16 isTarget);
  70.     
  71.     virtual void SetEditable( Int16 canEdit);
  72.     virtual Boolean IsEditable( void);
  73.     
  74.     virtual void GetSelection( Int16 *startSel, Int16 *endSel);
  75.     virtual void SetSelection( Int16 startSel, Int16 endSel);
  76.     virtual void SelectAll( void);
  77.     
  78.     virtual void SetPassReturns( Int16 passFlag);
  79.     virtual Boolean GetPassReturns( void);
  80.     
  81.     virtual void GetString( StringPtr string);
  82.  
  83.     virtual void Hide( void);
  84.     virtual void ClearText( void);
  85.     virtual Boolean    IsDirty( void);
  86.     virtual void SetDirty( Boolean dirty);
  87.     virtual Int16    GetLineCount( void);
  88.     virtual char GetLastChar( void);
  89.     
  90.     virtual void MakeTETask( tTE_Command theCommand);
  91. };